package com.registerserver.service;

import java.sql.Date;
import java.text.SimpleDateFormat;

public class DateFactory {
	public static final String getCurrentSemesterID(){
		Date date = new Date(System.currentTimeMillis());
		SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
		SimpleDateFormat monthFormat = new SimpleDateFormat("MM");
		String year = yearFormat.format(date.getTime());
		int month =Integer.valueOf(monthFormat.format(date.getTime()));
		
		String suffix = "";
		if (month>=9 && month<=12){
			suffix = "001";
		}
		else if (month>=1 && month<=4){
			suffix = "002";
		}
		else suffix = "003";
		return year+suffix;
	}
	
	public static final Date getCurrentDate(){
		Date date = new Date(System.currentTimeMillis());
		return date;
	}
}


